<?php 
class PublicController extends Zend_Controller_Action{
    private $_arrParam;

    
    public function init(){
        parent::init();        
        $this->_arrParam = $this->_request->getParams();
        $this->view->arrParam = $this->_arrParam;
    }
    

    public function loginAction(){
    	$form=new Form_Login;
         
        if($this->_request->isPost()){
    	     //check validate error tu form
            $validator = new Default_Form_ValidateLogin($this->_arrParam);
            if($validator->isValid()){
                $this->view->errors = $validator->getMessageErrors();
                $this->view->Item = $validator->getData();
                echo("Validator Valid");
            }else{
                $auth = new hieulib_System_Auth();
                echo("Validator Not Valid");
                
                if($auth->login($this->_arrParam) == true){                    
                    //dang nhap thanh cong
                }
            }
        }
        $this->view->form=$form;
        
        
        
        
        
        
    }
    
    public function logoutAction(){
        $auth = new hieulib_System_Auth();
        $auth->logout();
        $this->_redirect('/default');
    }
}